<?php
namespace Plu\Library\Validation\Validator;

use Phalcon\Validation,
	Phalcon\Validation\Validator,
	Phalcon\Validation\Message;


class ChinaMobile extends Validator {
	public function validate(Validation $validator, $attribute) {
		$value = $validator->getValue($attribute);

		if (preg_match('/^1[3|4|5|7|8]\d{9}$/', $value)) {
			return true;
		} else {
			$validator->appendMessage(new Message("传入的手机号码不合法", $attribute, 'ChinaMobile'));
			return false;
		}
	}
}

?>
